<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.Constants"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/purchaseOrderReceipt.do"/>
<%
    String chipTracContext = "/" + ConfigManager.getChipTracContext();
    String functionalityString = Functionality.PURCHASE_ORDER;
%>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
<%
	String source = request.getParameter( "source" );
	if( source == null )
	{
		source = "";
	}
%>
var source = '<%=source%>';

function editPurchaseOrderReceipt()
{
	if( source == 'po' )
	{
		document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrders.do?action=edit';
	}
	else
	{
		document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrderReceipt.do?action=edit' ;
	}
    
    document.purchaseOrderReceiptForm.submit();
}

function confrimPurchaseOrderReceipt()
{
	if( source == 'po' )
	{
		document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrders.do?action=save';
	}
	else
	{
		document.purchaseOrderReceiptForm.action='<%=chipTracContext%>/purchaseOrderReceipt.do?action=save' ;
	}
    
    document.purchaseOrderReceiptForm.submit();
}

</script>

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@include file="/jsp/finance/purchase_order_menu.jsp" %>
            <!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
<!-- from here your body starts -->
<html:form name="purchaseOrderReceiptForm" type="com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderReceiptForm" action="/purchaseOrderReceipt.do">
        <bean:define id="searchType" name="searchType" scope="request"/>
        <table border="0" align = "left" width ="100%" >
         <TR>
                <TD WIDTH="100%">
                    <TABLE BORDER="0" WIDTH="100%" HEIGHT="175%">
                        <TR>
                            <TD WIDTH="100%" align = "">
                                <table width="75%"><tr><td><center><FONT id="poErrors" styleClass="NArialL"><b>Confirm Purchase Order Receipt Entry</b></FONT></center></td></TR></table>
                            </TD>
                        </TR>
                    </TABLE>
                    <BR>
                    <TABLE BORDER="0" WIDTH="100%" class="NArialL" bordercolor='red'>
                        <bean:define name="purchaseOrderReceiptForm" id="form" type="com.scalar.chiptrack.finance.openpo.forms.PurchaseOrderReceiptForm"/>
                        <%
							String action = request.getParameter( "action" );
							if( action != null && com.scalar.chiptrack.commons.Constants.ACTION_CONFIRM.equalsIgnoreCase( action ) )
							{
                        %>

                        <%
                            if (form.getPoType() == Constants.PO_TYPE_OPEN && form.getTotal() > form.getRemainingPOAmount())
                            {
                        %>

                                <tr>
                                    <td colspan="5" class="NArialL"><font color="red"><li>Warning: PO receipt amount exceeded the Remaining PO Amount</li></font></td>
                                </tr>
                        <%
                            }
                        %>
                        <tr>
							<td colspan="2">&nbsp;
							</td>
							<td colspan="4" id="imagesIndex" align="right">
								<a href="javascript:editPurchaseOrderReceipt();" class="leftsection" onmouseover="window.status='';return true" onmouseout="window.status='';return true">
								<img border="0" src="<%=chipTracContext%>/jsp/includes/images/edit.gif" title="" ></a>
								<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width='50' height='10'>
								<a href="javascript:confrimPurchaseOrderReceipt();" class="leftsection" onmouseover="window.status='';return true" onmouseout="window.status='';return true">
								<img border="0" src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" title="" ></a>
							</td>
							<td>&nbsp;</td>
						</tr>
						<%
							}	
						%>
						<TR>
                            <TD colspan = "7">&nbsp;</TD>
                        <TR>
                            <TD WIDTH="1%">&nbsp;</TD>
                            <TD WIDTH="14%">Receipt Number:</TD>
                            <TD WIDTH="17%" align = "left">
                                <bean:write  name="purchaseOrderReceiptForm" property="receipt_Number"/>
                            </TD>
                            <TD WIDTH="4%">&nbsp;</TD>
                            <TD WIDTH="14%">PO Number:</TD>
                            <TD WIDTH="30%"><html:hidden name="purchaseOrderReceiptForm" property="vendorDocNumber"/>
                                <bean:write name="purchaseOrderReceiptForm" property="purchaseOrderNumber"/>
                            </TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD WIDTH="1%">&nbsp;</TD>
                            <TD WIDTH="14%">Vendor Name:&nbsp;</TD>
                            <TD WIDTH="17%">
                                <bean:write name="purchaseOrderReceiptForm" property="vendorName"/>
                            </TD>
                            <TD WIDTH="4%">&nbsp;</TD>
                            <TD WIDTH="14%">Receipt Date:&nbsp;</TD>
                            <TD WIDTH="25%">
                                <bean:write name="purchaseOrderReceiptForm" property="receiptDate"/>
                            </TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD WIDTH="1%">&nbsp;</TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                            <TD WIDTH="17%">&nbsp;</TD>
                            <TD WIDTH="4%">&nbsp;</TD>
                            <nested:equal value="<%=Integer.toString(Constants.PO_TYPE_OPEN)%>" property="poType">
                                <TD WIDTH="14%">PO Max $:</TD>
                                <TD WIDTH="25%"><bean:write name="purchaseOrderReceiptForm" property="poMaxAmtFormatted"/></TD>
                                <TD WIDTH="14%">&nbsp;</TD>
                            </nested:equal>
                        </TR>
                        <TR>
                            <TD WIDTH="1%">&nbsp;</TD>
                            <TD WIDTH="14%">Invoice Number:&nbsp;</TD>
                            <TD WIDTH="17%">
                                <bean:write name="purchaseOrderReceiptForm" property="invoiceNumber"/>
                            </TD>
                            <TD WIDTH="4%">&nbsp;</TD>
                            <nested:equal value="<%=Integer.toString(Constants.PO_TYPE_OPEN)%>" property="poType">
                                <TD WIDTH="14%">Remaining PO $:</TD>
                                <TD WIDTH="25%"><bean:write name="purchaseOrderReceiptForm" property="remainingPOAmountFormatted"/></TD>
                                <TD WIDTH="14%">&nbsp;</TD>
                            </nested:equal>
                        </TR>
                    </TABLE>
                    <BR>
                    <BR>
                    <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
                        <TR>
                            <TD WIDTH = "100%" COLSPAN="11">
                                <FONT id="lineItemErrors" styleClass="NArialL" color="red"></FONT>
                            </TD>
                        </TR>
                        <TR>
                            <TD WIDTH="4%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER">&nbsp;<FONT COLOR="white">Line Item #</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Process Name</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="26" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Part Number</FONT>
                            </TD>
                            <TD WIDTH="16%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Description</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Package Type</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Requested Date</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Received Date</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Requested Quantity</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Previous Received Quantity</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Received Quantity</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
<!-- 								<table>
									<tr> -->
										<P ALIGN="CENTER"><FONT COLOR="white">Lot Information</FONT>
<!-- 									</tr>
									<tr>
										<P ALIGN="CENTER"><FONT COLOR="white"><td>Lot#</td></FONT>
										<P ALIGN="CENTER"><FONT COLOR="white"><td>QtyIn</td></FONT>
										<P ALIGN="CENTER"><FONT COLOR="white"><td>QtyOut</td></FONT>
									</tr>
								</table> -->
                            </TD>
                            <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Unit Cost($)</FONT>
                            </TD>
                            <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
                                <P ALIGN="CENTER"><FONT COLOR="white">Extended Cost($)</FONT>
                            </TD>
                        </TR>
						<nested:iterate id="recevinglineItem" property="receivingLineItemList" type="com.scalar.chiptrack.finance.openpo.ReceivingLineItem" indexId="lineItemIndex">
						<nested:hidden property="selected"/>
						<%
							if( recevinglineItem.isSelected() || source.equalsIgnoreCase( "po" ) )
							{
						%>
						
						<TR>
							<TD WIDTH="4%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
								<nested:write property="purchaseOrderLineItemNumber"/>
							</TD>
							<TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
								<nested:write property="processName"/>
                            </TD>
                            <TD WIDTH="10%" BGCOLOR="#DEE1E2" ALIGN="CENTER">
								<nested:write property="partNumber"/>
                            </TD>
                            <TD WIDTH="16%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
								<nested:write property="description"/>
	                        </TD>
                            <TD WIDTH="16%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
								<nested:write property="packageType"/>
                            </TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2" nowrap>
								<nested:write property="requestedDate"/>
                            </TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2" nowrap>
								<nested:write property="receivedDate"/>
	                        </TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                <nested:write property="requestedQuantity"/>
                            </TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                <nested:write property="previouslyShipppedQty"/>
                            </TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2" nowrap>
                                <nested:write property="shippedQty"/>
                            </TD>
							<TD ALIGN="CENTER" BGCOLOR="#DEE1E2">
							<table CLASS="NArialL">
							<nested:iterate id="dataEntry" property="purchaseOrderLineItemLotDataEntryList" type="com.scalar.chiptrack.finance.openpo.PurchaseOrderLineItemLotDataEntry">
                                <nested:equal value="true" property="selected">
                                    <tr>
                                        <td ALIGN="CENTER" BGCOLOR="#DEE1E2"><nested:write property="lotNumber"/></td>
                                        <td ALIGN="CENTER" BGCOLOR="#DEE1E2"><nested:write property="qtyPulled"/></td>
                                       <%-- <td ALIGN="CENTER" BGCOLOR="#DEE1E2"><nested:write property="qtyOut"/></td>--%>
                                    </tr>
                                </nested:equal>
                            </nested:iterate>
							</table>
							</TD>
                            <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
                                <nested:write property="unitCost"/>
                            </TD>
                            <TD WIDTH="10%" ALIGN="Right" BGCOLOR="#DEE1E2">
                                <nested:write property="extendedCostAsString"/>
                            </TD>
                        </TR>
						<%
							}
						%>
                        </nested:iterate>
                        <TR>
                            <TD width="20%" colspan="9">&nbsp;</TD>
                            <TD WIDTH="20%">&nbsp;</TD>
                            <TD WIDTH="12%">&nbsp;</TD>
                            <TD WIDTH="26%">&nbsp;</TD>
                            <TD WIDTH="8%">&nbsp;</TD>
                        </TR>
                        <TR>
							<TD WIDTH="20%" colspan="11">&nbsp;</TD>
							<TD WIDTH="26%" ALIGN="right">Sub Total:&nbsp;$</TD>
							<TD WIDTH="8%" align="right">
								<bean:write name="purchaseOrderReceiptForm" property="sub_totalAsString"/>
							<TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD width="20%" colspan="11"></TD>
                            <TD WIDTH="26%" ALIGN="right">Freight:&nbsp;$</TD>
                            <TD WIDTH="8%" align="right"><bean:write name="purchaseOrderReceiptForm" property="frieght"/></TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD width="20%" colspan="11"></TD>
                            <TD WIDTH="26%" ALIGN="right" nowrap>Trade Discount:&nbsp;$</TD>
                            <TD WIDTH="8%" align="right"><bean:write name="purchaseOrderReceiptForm" property="trade_Discount"/></TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD WIDTH="40%" colspan="11"></TD>
                            <TD WIDTH="26%" ALIGN="right">Miscellaneous:&nbsp;$</TD>
                            <TD WIDTH="8%" align="right"><bean:write name="purchaseOrderReceiptForm" property="miscellaneous"/></TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
							<TD WIDTH="40%" colspan="2"></TD>
							<TD WIDTH="40%" colspan="2" align="right">PO Tax State:</TD>
							<TD WIDTH="40%" align="left">
                                <html:select name="purchaseOrderReceiptForm" property="poTaxType" styleClass="txfield" disabled="true">
                                    <html:option value="0" >Non Taxable</html:option>
                                    <html:options collection="poTaxTypes" property="value" labelProperty="label" />
                                    <html:option value="-1">Others</html:option>
                                </html:select>
							</TD>
                            <TD WIDTH="26%" colspan="7" ALIGN="right">Tax:&nbsp;$</TD>
                            <TD WIDTH="8%" align="right"><bean:write name="purchaseOrderReceiptForm" property="tax"/></TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD width="20%" colspan="11">&nbsp;</TD>
                            <TD WIDTH="26%" ALIGN="right">Order Total:&nbsp;$</TD>
                            <TD WIDTH="8%" align="right"><bean:write name="purchaseOrderReceiptForm" property="totalAsString"/></TD>
                            <TD WIDTH="14%">&nbsp;</TD>
                        </TR>
                        <TR>
                            <TD width="20%" colspan="11">&nbsp;</TD>
                            <TD WIDTH="20%">&nbsp;</TD>
                            <TD WIDTH="12%">&nbsp;</TD>
                            <TD WIDTH="8%">&nbsp;</TD>
                    </TR>
                    <TR>
                        <TD width="20%" colspan="8">&nbsp;</TD>
                        <TD WIDTH="26%">&nbsp;</TD>
                        <TD WIDTH="8%">
                        </TD>
                        <TD WIDTH="12%">&nbsp;</TD>
                        <TD WIDTH="14%">&nbsp;</TD>
                    </TR>
                    </TABLE>
                    <BR>
                </TD>
           </TR>
          </TABLE>
<input type="hidden" name="searchType" value="<bean:write name="searchType"/>">
</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

